HAL SDIO types migration ¶
This section provides information about the HAL SDIO types migration.
HAL SDIO callback ID type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef enum
{
HAL_SDIO_TX_CPLT_CB_ID,
HAL_SDIO_RX_CPLT_CB_ID,
HAL_SDIO_ERROR_CB_ID,
HAL_SDIO_MSP_INIT_CB_ID,
HAL_SDIO_MSP_DEINIT_CB_ID
} HAL_SDIO_CallbackIDTypeDef;
|
Callback registration and handling changed, see below note. Note The callback registration in HAL2 is handled by specific functions for each SDIO event. The update from HAL1 to HAL2 involves a significant change in the way callback functions are registered for SDIO events. Refer to HAL SDIO callback registration. |
Related concepts:
HAL SDIO callback type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef void (*pSDIO_CallbackTypeDef)(SDIO_HandleTypeDef *hsdio)
|
typedef void (*hal_sdio_cb_t)(hal_sdio_handle_t *hsdio)
typedef void (*hal_sdio_xfer_cb_t)(hal_sdio_handle_t *hsdio,
hal_sdio_event_cb_t cb_event)
Note
In HAL2 the general callback type has been split:
|
typedef void (*HAL_SDIO_IOFunction_CallbackTypeDef)(SDIO_HandleTypeDef *hsdio,
uint32_t func)
|
typedef void (*hal_sdio_io_function_cb_t)(hal_sdio_handle_t *hsdio,
uint32_t func)
|
typedef HAL_StatusTypeDef(*pSDIO_IdentifyCardCallbackTypeDef)(SDIO_HandleTypeDef *hsdio)
|
typedef hal_status_t (*hal_sdio_identify_card_t)(hal_sdio_handle_t *hsdio)
Note
|
typedef void (*pSDIO_TransceiverCallbackTypeDef)(SDIO_HandleTypeDef *hsdio,
FlagStatus status)
|
typedef void (*hal_sdio_transceiver_cb_t)(hal_sdio_handle_t *hsdio,
hal_sdio_transceiver_state_t state)
|
HAL SDIO state type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef enum
{
HAL_SDIO_STATE_RESET,
HAL_SDIO_STATE_READY,
HAL_SDIO_STATE_BUSY
} HAL_SDIO_StateTypeDef;
|
typedef enum
{
HAL_SDIO_STATE_RESET,
HAL_SDIO_STATE_INIT,
HAL_SDIO_STATE_CARD_REMOVED,
HAL_SDIO_STATE_IDLE,
HAL_SDIO_STATE_ACTIVE
} hal_sdio_state_t;
|
Related concept:
Revised and optimized HAL state machine
HAL SDIO CCCR type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t card_capability
uint32_t commonCISPointer
uint8_t sdio_revision
uint8_t cccr_revision
uint8_t sd_spec_revision
uint8_t bus_width_8Bit
} HAL_SDIO_CCCR_TypeDef;
|
typedef struct
{
uint32_t card_capability
uint32_t common_cis_pointer
uint8_t sdio_revision
uint8_t cccr_revision
uint8_t sd_spec_revision
hal_sdio_bus_width_8bit_t bus_width_8Bit
} hal_sdio_cccr_t;
|
HAL SDIO direct command type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint8_t ReadAfterWrite
uint32_t Reg_Addr
uint8_t IOFunctionNbr
} HAL_SDIO_DirectCmd_TypeDef;
|
typedef struct
{
hal_sdio_raw_t read_after_write
uint32_t reg_addr
hal_sdio_function_t io_function_nbr
} hal_sdio_direct_cmd_t;
|
HAL SDIO extended command type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t OpCode
uint32_t Block_Mode
uint32_t Reg_Addr
uint32_t IOFunctionNbr
} HAL_SDIO_ExtendedCmd_TypeDef;
|
typedef struct
{
hal_sdio_operation_code_inc_t operation_code
hal_sdio_block_mode_t block_mode
uint32_t reg_addr
hal_sdio_function_t io_function_nbr
} hal_sdio_extended_cmd_t;
|
HAL SDIO FBR type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t ioPointerToCIS
uint32_t ioPointerToCSA
uint8_t flags
uint8_t ioStdFunctionCode
uint8_t ioExtFunctionCode
} HAL_SDIO_FBR_t;
|
typedef struct
{
uint32_t io_pointer_to_cis
uint32_t io_pointer_to_csa
uint8_t flags
uint8_t io_std_function_code
uint8_t io_ext_function_code
} hal_sdio_fbr_t;
|
HAL SDIO handle type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef SDIO_HandleTypeDef
|
typedef hal_sdio_handle_t
|
HAL SDIO initialization type definition ¶
|
HAL1 |
HAL2 |
|---|---|
#define SDIO_InitTypeDef SDMMC_InitTypeDef
typedef struct
{
uint32_t ClockEdge,
uint32_t ClockPowerSave,
uint32_t ClockDiv,
uint32_t BusWide,
uint32_t HardwareFlowControl,
uint32_t TranceiverPresent
} SDMMC_InitTypeDef;
|
typedef struct
{
typedef struct
{
hal_sdio_clock_edge_t clk_edge,
hal_sdio_clock_power_save_t clk_power_save,
uint32_t clk_hz,
/* ClockDiv is replaced by clk_hz see below note for details */
} hal_sdio_clock_config_t
hal_sdio_bus_wide_t bus_wide,
hal_sdio_hardware_flow_control_t hw_flow_ctrl,
hal_sdio_transceiver_t transceiver
uint32_t data_timeout_cycle
} hal_sdio_config_t;
|
Note
In HAL1, the user had to provide the clock divider manually, by choosing from the defined division factors in SDMMC layer (
SDMMC_NSPEED_CLK_DIV, SDMMC_HSPEED_CLK_DIV...).In HAL2, the user provides the clock frequency, and the clock divider calculation is done internally based on the provided frequency.
HAL SDIO instance type definition ¶
Note
In HAL1, this define was a redirection to
device.hto provide the SDIO instance.In HAL2, the instances are provided with the following enumeration type.
|
HAL1 |
HAL2 |
|---|---|
typedef SDIO_TypeDef
|
typedef enum
{
HAL_SDIO_CARD_1,
HAL_SDIO_CARD_2
} hal_sdio_t;
|